<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="moduleTitle" class="tl-dialog" :close-on-click-modal="false" width="1200px" @close="close" :append-to-body="true" :modal-append-to-body="true">
    <file-list ref="fileList" type="list" :flowid="flowid" :nodeid="nodeid" :flowinsid="flowinsid" :nodeinsid="nodeinsid" :disableEditSubmit="disableEditSubmit" @refresh="doRefresh"></file-list>
    <div slot="footer" class="dialog-footer"></div>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_edit } from "@tapui/mixins/mixin_edit"
/** 子组件 */
import { validateNull } from "@tapui/utils/validate"
import fileList from "./list"
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from "@tapui/utils/http"
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: { fileList },
  data() {
    return {
      moduleTitle: "流程文件",
      urlPrefix: "/base/flowFile/",
      url: {
        // 额外的url
        saveFlowFileIns: "/base/flowFileIns/batchSave"
      },
      sorterInfo: {
        sidx: "createon",
        sord: "desc"
      },
      filtersInfo: {
        flow_id: this.flowid,
        node_id: this.nodeid,
        flow_inst_id: this.flowinsid,
        node_inst_id: this.nodeinsid
      }
    }
  },
  props: {
    flowid: {
      default: 0,
      type: Number
    },
    nodeid: {
      default: 0,
      type: Number
    },
    flowinsid: {
      default: 0,
      type: Number
    },
    nodeinsid: {
      default: 0,
      type: Number
    }
  },
  methods: {
    loaded() {},
    // 保存文件到文件实例
    asynSave(resolve, reject) {
      let paraMap = {}
      paraMap.filtersInfo = this.filtersInfo
      postAction(this.url.saveFlowFileIns, paraMap)
        .then((res) => {
          resolve(res)
        })
        .catch((e) => {
          reject(e)
        })
    }
  }
}
</script>
